import request from '@/utils/request'

// 获取统计概览数据
export function getOverviewStatistics(query) {
  return request({
    url: '/device/statistics/overview',
    method: 'get',
    params: query
  })
}

// 获取设备详细统计列表
export function getDeviceStatistics(query) {
  return request({
    url: '/device/statistics/device/list',
    method: 'get',
    params: query
  })
}

// 获取连接趋势图表数据
export function getConnectionChart(query) {
  return request({
    url: '/device/statistics/chart/connection',
    method: 'get',
    params: query
  })
}

// 获取设备状态分布数据
export function getStatusChart() {
  return request({
    url: '/device/statistics/chart/status',
    method: 'get'
  })
}

// 获取地域分布数据
export function getRegionChart(query) {
  return request({
    url: '/device/statistics/chart/region',
    method: 'get',
    params: query
  })
}

// 获取时段分析数据
export function getHourChart(query) {
  return request({
    url: '/device/statistics/chart/hour',
    method: 'get',
    params: query
  })
}

// 获取设备详细信息
export function getDeviceDetail(deviceId, query) {
  return request({
    url: '/device/statistics/device/detail',
    method: 'get',
    params: { deviceId, ...query }
  })
}

// 导出统计报表
export function exportStatistics(query) {
  return request({
    url: '/device/statistics/export',
    method: 'post',
    params: query,
    responseType: 'blob'
  })
}
